package com.caoheng.pay.pay.channel.wrap;

import com.caoheng.core.common.body.PayRequestBody;
import com.caoheng.core.enums.PayType;
import com.caoheng.pay.pay.channel.AliPayChannel;
import com.caoheng.pay.pay.channel.PayChannel;
import com.caoheng.pay.pay.channel.WechatPayChannel;

/**
 * @ClassName RoutePayChannel
 * @Description TODO
 * @Author shuimodanqing
 * @Date 2018/12/20 2:23 PM
 */
public class RoutePayChannel implements PayChannel {

    private PayChannel delegate;

    public RoutePayChannel(PayType payType, PayRequestBody requestBody){
        switch (payType){
            case ALI_PAY_MOBILE:
                delegate = new AliPayChannel();
                break;
            case ALI_PAY_PC:
                delegate = new WechatPayChannel();
        }
    }

    @Override
    public <E> E execute() {
        return this.delegate.execute();
    }
}
